﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Billing.aspx.cs" Inherits="ClientBilling.Billing" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Billed Call Records</title>
    <link href="~/Intranet.css" rel="Stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h3>Billed Calls</h3>
        <asp:Repeater runat="server" ID="CallRecordRepeater" 
            DataSourceID="RecordDataSource" 
            onitemdatabound="CallRecordRepeater_ItemDataBound">
            <ItemTemplate>
                <div class="client">
                    <span class="clientName">
                        <asp:Label runat="server" id="ClientNameLabel"><%# DataBinder.Eval(Container.DataItem, "ClientName") %></asp:Label>
                    </span>
                    <asp:Label runat="server" ID="CallDetailsLabel">
                        <%# ClientBilling.Billing.FormatCallDetails((DateTime)DataBinder.Eval(Container.DataItem, "Start"), 
                            (TimeSpan)DataBinder.Eval(Container.DataItem, "CallDuration")) %>
                    </asp:Label>         
                    <asp:Repeater runat="server" ID="CaseAllocationRepeater">
                        <ItemTemplate>
                            <div class="caseName">
                                <asp:Label runat="server" ID="CaseNameLabel"><%# DataBinder.Eval(Container.DataItem, "CaseName") %></asp:Label>
                                <asp:Label runat="server" ID="PercentageLabel"><%# ((decimal)DataBinder.Eval(Container.DataItem, "PortionOfCall")).ToString("P") %></asp:Label>
                            </div>
                        </ItemTemplate>
                    </asp:Repeater>
                </div>
            </ItemTemplate>
        </asp:Repeater>
        
        <asp:ObjectDataSource ID="RecordDataSource" runat="server" 
            SelectMethod="GetCallRecords" TypeName="ClientBilling.BilledCallTracker">
        </asp:ObjectDataSource>
        
    </div>
    </form>
</body>
</html>
